package com.hw.weathershow.factory;

import com.hw.weathershow.configuration.WeatherConfig;
import com.hw.weathershow.factory.getter.MapperFactory;
import com.hw.weathershow.factory.getter.UtilFactory;
import com.hw.weathershow.factory.observer.ObserverFactory;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;


/**
 * @author Cejay1314
 * @version 1.0
 * @create 2022/12/6 16:06
 */
@Component
@Getter
public class ProduceFactory {
    @Autowired
    ObserverFactory observerFactory;
    @Autowired
    UtilFactory utilFactory;
    @Autowired
    MapperFactory mapperFactory;

    public AbstractFactory getFactory(String factory){
        if(factory.equals("ObserverFactory"))
            return observerFactory;
        return null;
    }

//    @Bean
//    @Lazy
//    public ObserverFactory getObserverFactory() {
//        return observerFactory;
//    }
//
//    @Bean
//    public UtilFactory getUtilFactory() {
//        return utilFactory;
//    }
//
//    @Bean
//    public MapperFactory getMapperFactory() {
//        return mapperFactory;
//    }
}
